DEMO 1: A function is a defined block of code that has a specific task.

A function will not run until it is called. You can call a function anywhere in your code after you define it.

  • Click Run to see a the parts of a function.
  • Click the words Next Step on the stage to see what each line does.
  • Click Submit and Next to answer the questions about functions in the next activity.

To navigate the page using the TAB key, first press ESC to exit the code editor.

def tour(): sprite = codesters.Sprite("person1", -150, -60) sprite.say("I can take you on a tour") sprite.move_forward(550) tour()
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)